<?php
namespace Home\Model;
use Think\Model;

/**
 * Created by PhpStorm.
 * User: 田家强
 * Date: 2017/4/1
 * Time: 21:07
 */

class BaseModel extends  Model
{
    public function store($data)
    {
        if($this->create($data)){
            $action = isset($data[$this->pk])? 'save':'add';
            $res = $this->$action($data);

            return['valid'=>'success','msg'=>'操作成功','$data'=>$res];
        }else{
            return['valid'=>'failed','msg'=>$this->getError()];

        }


    }




}